﻿/*
* Created By @ Dzung.NguyenManh    
* Created Date: 
* Email:Dzung.nguyenmanh@gmail.com
* Modidy Date:
* Compayny : MITC.co
* Address:
*/
namespace Mitc.Portal.Core.CoreHelper
{
    #region Reference
    using System;
    using System.ComponentModel;
    using System.Linq;
    using System.Reflection;

    #endregion

    public partial class Common
    {



    }
    public partial class ReturnMessager
    {
        public bool MessagerStatust { get; set; }
        public string MessagerContent { get; set; }
        public string MessagerTitle { get; set; }

        public ReturnMessager()
        {
            // TODO: Complete member initialization
        }
    }
    public partial class Contant
    {
        public static readonly string Pages = "Pages";
        public static readonly string Defaultpage = "default.aspx";
        public static readonly string Contenttype = "VTVNews";
        public static readonly string PageLayoutHome = "/_catalogs/masterpage/VTV.LayoutHome.aspx";
        public static readonly string PageLayoutHomeName = "VTV.LayoutHome.aspx";
        public static readonly string PageLayoutNews = "/_catalogs/masterpage/VTV.LayoutNews.aspx";
        public static readonly string DetailPageLayout = "/_catalogs/masterpage/VTV.LayoutDetail.aspx";
        public static readonly string ListPageLayout = "/_catalogs/masterpage/VTV.LayoutList.aspx";
        public static readonly string PageLayoutFileName = "VTV.LayoutNews.aspx";
        public static readonly string DetailPageLayoutName = "VTV.LayoutDetail.aspx";
        public static readonly string ListPageLayoutName = "VTV.LayoutList.aspx";
        public static readonly string ContentTypeField = "ContentType";
        public static readonly string BackupMenu = "MenuConfig.stp";
        public static readonly string RootWebName = "daitruyenhinhvietnam";
        public static readonly string Pageindex = "Pageindex";
        public static readonly string Pagesize = "Pagesize";
        public static readonly string HotNews = "HotNewsJob";
        public static readonly string HotNewsList = "HotNews";
        public static readonly string UrlHostnewConfig = "HotnewConfig";

        public static class MenuLeftFields
        {
            public static readonly string ListName = "MenuConfig";

            public static readonly string Title = "title";
            public static readonly string Url = "RelativateUrl";
            public static readonly string Order = "Order";
            public static readonly string Display = "Display";
            public static readonly string DisplayInTop = "DisplayInTop";
            public static readonly string GroupMenu = "GroupMenu";
            public static readonly string ParrentId = "ParentId";
            public static readonly string OldParrentId = "ParrentOldId";
        }

        public static class NewsFields
        {
            public static readonly string Title = "Title";
            public static readonly string PublishingPageImage = "PublishingPageImage";
            public static readonly string ShortContent = "ShortContent";
            public static readonly string IsHotnews = "IsHotNew";
            public static readonly string IsLineEvents = "IsLineEvents";
            public static readonly string NewsUrl = "NewsUrl";
            public static readonly string Publichser = "Publichser";
            public static readonly string PageContent = "PublishingPageContent";
            public static readonly string Publicshed = "Modified";
            public static readonly string Order = "Order";
            public static readonly string PublichImage = "PublishingPageImage";
            public static readonly string PreviewImage = "PreviewImage";
            public static readonly string Comments = "Comments";
            public static readonly string Status = "Approval Status";
        }
    }

    public static partial class StringHelper
    {
        public static string GetDescriptionEnum(Enum value)
        {
            FieldInfo fi = value.GetType().GetField(value.ToString());

            DescriptionAttribute[] attributes =
                (DescriptionAttribute[])fi.GetCustomAttributes(typeof(DescriptionAttribute), false);

            if (attributes != null && attributes.Length > 0)
                return attributes[0].Description;
            else
                return value.ToString();
        }

        public static string DatetimeConvert(DateTime dateobject, string dateformat)
        {
            var str = string.Empty;

            var day = dateobject.Day;
            var mon = dateobject.Month;
            var year = dateobject.Year;
            var i = dateobject.DayOfWeek.ToString();
            var thu = string.Empty;
            switch (i)
            {
                case "Monday":
                    thu = "2";
                    break;
                case "Tuesday":
                    thu = "3";
                    break;
                case "Wednesday":
                    thu = "4";
                    break;
                case "Thursday":
                    thu = "5";
                    break;
                case "Friday":
                    thu = "6";
                    break;
                case "Saturday":
                    thu = "7";
                    break;
                case "Sunday":
                    thu = "CN";
                    break;
            }


            str = string.Format(dateformat, thu, day, mon, year);

            return str;
        }
    }

    public static class SearchDefaultFields
    {
        // Các thành phần mà search query có thể lấy ra
        // Ex: SELECT {0} FROM SCOPE() WHERE \"scope\"='{1}'{2} ORDER BY Rank DESC --> {0}: DefaultResultFields
        public const string DefaultResultFields = "WorkId, Rank, Title, Author, Size, Path, Description, Write, SiteName, CollapsingStatus, HitHighlightedSummary, HitHighlightedProperties, ContentClass, IsDocument, PictureThumbnailURL";
        public const int DefaultRowLimit = 15;
        public const string DefaultHighLightTag = "b";
        public const string DefaultSearchScope = "AllSite";
        public const string DefaultUrl = "";
        public const string QueryKeyDebug = "debug";
        public const string QueryKeyPage = "page";
        public const string QueryKeyStartItem = "start";
        public const string QueryKeySearchScope = "s";
        public const string QueryKeySearchKeyWord = "k";
    }
}